test block
Window.settimeout (Func,delay);
Func that represents the function or code string to be executed.
Delay, delay parameter, in milliseconds, one second =1000 milliseconds.
When a function or statement passed in Func has a variable input,
SetTimeout () is the method of window, but we all skip the top-level Object Name of window. This is used to set a time. When the time is reached, a specified method will be executed.
SetTimeout
Example of setTimeout syntax
Use setTimeout
SetTimeout definition and usage: the SetTimeout () method is used to call a function or evaluate an expression after a specified number of milliseconds. Syntax: setTimeout (code,millisec) parameters: code (required): The JavaScript code string to
1. SetInterval () Use _ Learning
Copy Code code as follows:
Automatic execution every second of a method
var c=0;
function Showlogin ()
{
Alert (c + +);
}
SetInterval method or string, milliseconds, array of arguments
Example one:
View Demo Download source code
The settimeout () method is used to call a function or evaluate an expression after a specified number of milliseconds, while SetInterval () invokes the function or expression at the specified number of
Quickly learn how to use setTimeout and setInterval in Node. js, node. jssettimeout
Node. js and js also have timers, time-out timers, interval timers, and timely timers. They and the process. nextTick (callback) function are used to schedule events.
SetTimeoutdefinition and Usage:The SetTimeout () method is used to call a function or evaluate an expression after a specified number of milliseconds.Syntax:SetTimeout (CODE,MILLISEC)Parameters:Code (required): The JavaScript code string to execute
JavaScript's settimeout and setinterval functions are widely used to deal with delays and timed tasks, such as opening a Web page for a period of time after a pop-up login box, the page to send asynchronous requests every time to obtain the latest
In the writing H5 game often need to use the Timed Refresh page to achieve the animation effect, more commonly known as settimeout () and setinterval (), but everyone on the use of setinterval and settimeout understand, The following through this
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4
classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui>
Setinterval and setTimeout usage in S
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.